package com.grow.greenhouse.service;

import com.grow.greenhouse.domain.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.grow.greenhouse.domain.request.AddMemberRequest;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
* @author 23854
* @description 针对表【user】的数据库操作Service
* @createDate 2024-01-28 18:45:00
*/
public interface UserService extends IService<User> {


    /**
     * 发送邮箱验证码给用户
     * @param email
     *
     */
    void sendEmailVerifyCode(String email);


    /**
     * 用户注册
     * @param userAccount 用户账户
     * @param userName    用户昵称
     * @param userVeryCode 用户输入邮箱验证码
     * @param userPassword 用户密码
     * @return 新用户id
     */

    Map<String,Object> userRegister(String userName,String userVeryCode,String userAccount,String userPassword);

    /**
     * 用户登录
     * @param userAccount 用户账户
     * @param userPassword 用户密码
     * @return 脱敏后的用户信息
     */

    Map<String,Object> userLogin(String userAccount, String userPassword, HttpServletRequest request);


    /**
     * 用户脱敏
     * @param originUser  原用户信息
     * @return  脱敏后的用户信息
     */
    User getSafeUser(User originUser);


    /**
     * 用户注销
     * @param request
     * @return
     */
    int userLogout(HttpServletRequest request);

    /**
     * 更新用户信息
     * @param user
     * @return
     */
    int updateUser(User user,User LoginUser);

    /**
     * 获取当前用户信息
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    Map<String,List<User>> getMembers(HttpServletRequest request);

    String addMembers(AddMemberRequest addMemberRequest, HttpServletRequest request);
}
